﻿@model OrderSystem.Models.Items

@{
    ViewBag.Title = "Create";
}
<script type="text/javascript">
    function ReplaceCommaByDot(input) {
        input.value = input.value.replace(/,/g, '.');
    }
</script>
<h2>Create</h2>
<script src="@Url.Content("~/Scripts/jquery.validate.min.js")" type="text/javascript"></script>
<script src="@Url.Content("~/Scripts/jquery.validate.unobtrusive.min.js")" type="text/javascript"></script>

@using (Html.BeginForm()) {
    @Html.ValidationSummary(true)
    <fieldset>
        <legend>Items</legend>

        <div class="editor-label">
            @Html.LabelFor(model => model.ItemName)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.ItemName, new { @class = "textboxwidth" })
            @Html.ValidationMessageFor(model => model.ItemName)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.ItemDescriprion)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.ItemDescriprion, new { @class = "textboxwidth" })
            @Html.ValidationMessageFor(model => model.ItemDescriprion)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Price)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Price, new { onkeyup = "return ReplaceCommaByDot(this)", @class = "textboxwidth" })
            @Html.ValidationMessageFor(model => model.Price)
        </div>

        <div class="editor-label">
            @Html.LabelFor(model => model.Quantity)
        </div>
        <div class="editor-field">
            @Html.TextBoxFor(model => model.Quantity, new { @class = "textboxwidth" })
            @Html.ValidationMessageFor(model => model.Quantity)
        </div>

        <p>
            <input type="submit" value="Create" />
        </p>
    </fieldset>
}

<div>
    @Html.ActionLink("Back to List", "Index")
</div>
